home *** CD-ROM | disk | FTP | other *** search
/ Developer CD Series 1994 August: Tool Chest / Dev.CD Aug 94.toast / Tool Chest / OS⁄Toolbox / APPL loads APPL ƒ / Appl.a next >
Encoding:
Text File  |  1992-09-01  |  1.3 KB  |  49 lines  |  [TEXT/MPS ]

  1. ;
  2. ;    © Copyright 1990 Apple Computer, Inc.   All Rights Reserved.
  3. ;    
  4. ;    Programmed by Ricardo Batista, 07/06/90
  5. ;    
  6. ;    This glue code goes to the application we are loading
  7. ;
  8. ;
  9.  
  10.     INCLUDE 'Traps.a'
  11.     INCLUDE 'SysEqu.a'
  12.  
  13.  
  14.  
  15.  
  16.  
  17. GOTOAPP    PROC EXPORT
  18.  
  19. ;    st LoadTrap                        ; for debugging
  20.     link a6,#0                        ; no locals
  21.     lea myRegs,a0                    ; place to save all registers
  22.     movem.l d0-d7/a0-a7,(a0)        ; save registers
  23. ;    move.w SR,-(sp)                    ; save status register
  24. ;    ori.w #$0400,SR                    ; disable interrupts for a little bit
  25.     clr.l StkLowPt                    ; clear lowest recorded stack (before stack changes)
  26.     move.l CurStackBase,a7            ; now we have a stack
  27.     move.l CurrentA5,a5                ; now we have an a5
  28. ;    move.w (sp)+,SR                    ; reenable interrupts
  29.     move.l -4(a6),-(sp)                ; this is the paramblock pointer
  30.     moveq #0,d0                        ; clear d0
  31.     move.w CurJTOffset,d0            ; set offset to appl code in d0
  32.     addi.l #2,d0                    ; make it real offset to code
  33.     move.l a5,a0                    ; put a5 in a0
  34.     adda.l d0,a0                    ; now a5 points to first code entry
  35.     jsr (a0)                        ; go to the application
  36.     lea myRegs,a0                    ; place where all registers were saved
  37.     movem.l (a0),d0-d7/a0-a7        ; recover registers (including stack and a5)
  38.     unlk a6                            ; destroy stack frame
  39.     rts                                ; return to caller
  40.  
  41.     ALIGN
  42. myRegs
  43.     dcb.b 80,0        ; space to save the registers
  44.  
  45.     ENDP
  46.     
  47.     
  48.     
  49.     END